package Day02;

import java.util.Scanner;

/**
 * 前缀和
 * i=1 开始  s[0]=0
 * s[i] = s[i-1] + ai
 * s[l] - s[r-1]
 */
public class PrefixSum {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] arr = new int[Common.N];
        int[] s = new int[Common.N];
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            arr[i] = scanner.nextInt();
        }
        // 前缀和的初始化
        for (int i = 1; i <= n; i++) {
            s[i] = s[i-1] + arr[i];
        }
        int l = scanner.nextInt();
        int r = scanner.nextInt();
        while (m!=0){
            // 区间计算
            System.out.printf("%d\n",s[r]-s[l-1]);
            m--;
        }
    }
}
